//
//  CAIImagePickerManagerErrorConst.m
//  CAIImagePickerControllerKit
//
//  Created by 海参 on 2022/7/26.
//

#import "CAIImagePickerManagerErrorConst.h"

@implementation CAIImagePickerManagerErrorConst



+ (NSError *)errorWithCode:(ImagePickerControllerErrorCode)code
{
    NSString *description;
    switch (code) {
        case ImagePickerControllerErrorCodeNOCameraAuthorization:
            description = @"没有相机权限";
            break;
        case ImagePickerControllerErrorCodeNOPhotoLibraryAuthorization:
            description = @"没有相册权限";
            break;
        case ImagePickerControllerErrorCodeCancel:
            description = @"取消";
            break;
        default:description = @"";
            break;
    }
    NSDictionary *dic = [NSDictionary dictionaryWithObject:description forKey:NSLocalizedDescriptionKey];
    NSMutableDictionary *userInfo = [NSMutableDictionary dictionaryWithDictionary:dic];
    NSError *error = [NSError errorWithDomain:@"com.ImagePickerManager" code:code userInfo:userInfo];
    return error;
}

@end
